package Thread;

public class TreadDemo8 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
            //这个线程的运行时间大约是1s
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        System.out.println("start之前:"+t.isAlive());
        t.start();
        System.out.println("start之后:"+t.isAlive());
        Thread.sleep(2000);//如果把2000改成1000，此时由于多线程调度，isAlive就未知了
        //2s之后线程t结束
        System.out.println("t结束之后:"+t.isAlive());
    }
}
